import request from '@/utils/request'

export default {
    //1.添加课程信息
    addCourseInfo(courseInfo) {
        return request({
            url: `/eduservice/course/addCourseInfo`,
            method: 'post',
            data: courseInfo
        })
    },
    //2.查询所有讲师
    getListTeacher() {
        return request({
            url: `/eduservice/teacher/findAll`,
            method: 'get'
        })
    },
    //3.根据课程id进行查询课程基本信息
    getCourseInfoId(cid) {
        return request({
            url: `/eduservice/course/getCourseInfo/${cid}`,
            method: 'get'
        })
    },
    //4.点击上一步_修改课程信息
    updateCourseInfo(courseInfoVo) {
        return request({
            url: `/eduservice/course/updateCourseInfo`,
            method: 'post',
            data: courseInfoVo
        })
    },
    //5.课程确认信息显示
    getPublishCourseInfo(cid) {
        return request({
            url: `/eduservice/course/getPublishCourseInfo/${cid}`,
            method: 'get'
        })
    },
    //6.课程最终发布 修改课程状态
    publishCourse(cid) {
        return request({
            url: `/eduservice/course/publishCourse/${cid}`,
            method: 'post'
        })
    },
    //课程分类列表(条件查询分页)
    //三个参数
    //courseQuery条件对象，后端使用 
    //RequestBody 获取数据
    //data表示把对象转成json进行传递到接口里面
    pageCourseCondition(current, limit, courseQuery) {
        return request({
            url: `/eduservice/course/pageCourseCondition/${current}/${limit}`,
            method: 'post',
            data: courseQuery
        })
    },
    //根据课程id删除课程
    deleteCourse(courseId) {
        return request({
            url: `/eduservice/course//${courseId}`,
            method: 'delete'
        })
    }
}
